//
//  LBViewController.m
//  LBWebView
//
//  Created by 408939786@qq.com on 05/31/2017.
//  Copyright (c) 2017 408939786@qq.com. All rights reserved.
//

#import "LBViewController.h"
#import <LBWebView/LBWebView.h>

@interface LBViewController ()<LBWebViewDelegate>

@property (nonatomic, strong) LBWebView *webView;

@end

@implementation LBViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    LBWebView *webView = [[LBWebView alloc] initWithFrame:CGRectInset(self.view.frame, 0, 0)
                                                 delegate:self];
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://127.0.0.1/jsBridgeTest"]];
    [webView loadRequest:request];
    
    self.webView = webView;
    [self.view addSubview:self.webView];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"push"
                                                                              style:UIBarButtonItemStylePlain
                                                                             target:self
                                                                             action:@selector(gotoNext)];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)gotoNext{
    [self.navigationController pushViewController:[[LBViewController alloc] init] animated:YES];
}

#pragma mark - LBWebViewDelegate
- (BOOL)LBWebView:(LBWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request{
    return YES;
}
- (void)LBWebViewDidStartLoad:(LBWebView *)webView{
    
}
- (void)LBWebViewDidFinishLoad:(LBWebView *)webView{
    
}
- (void)LBWebView:(LBWebView *)webView didFailLoadWithError:(NSError *)error{
    
}
- (void)LBWebView:(LBWebView *)webView didReceived:(NSString *)error{
    
}

- (void)LBWebView:(LBWebView *)webView didReceiveMessage:(LBWebViewBridge *)message{

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
